
class Fibo(object):

    def __init__(self,count):
        self.count = count
        self.nums = 0
        self.a = 0
        self.b = 1

    def __iter__(self):
        return self

    def __next__(self):
        if self.nums < self.count:
            ret = self.a
            self.a ,self.b = self.b,self.a+self.b
            self.nums += 1
            return ret
        else:
            raise StopIteration


fibo = Fibo(10)
for num in fibo:
    print(num)
